local oo = require("SharedLibs.BaseLib")
AsyncOpState = require("SharedLibs.AsyncOpState");
AsyncOp = require("SharedLibs.AsyncOp");

LambdaOp = oo.Class()
LambdaOp.name = "LambdaOp"
oo.ClassExtends(LambdaOp, AsyncOp)

function LambdaOp.prototype:constructor(lambda)
	LambdaOp._ss.prototype.constructor(self)
	
	self._state = AsyncOpState.Ready
	self._lambda = lambda;
end

function LambdaOp.prototype:_onStart()
	self._ret = self._lambda();
	self:_doStop(true);
end

function LambdaOp.prototype:GetReturn()
	return self._ret;
end

return LambdaOp;
